package com.xbongbong.paas.service;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.PaasFormDataEntity;
import com.xbongbong.paas.domain.entity.PaasProcessDataEntity;
import com.xbongbong.paas.domain.entity.ext.PaasFormEntityExt;
import com.xbongbong.paas.pojo.dto.FormDataAddDTO;
import com.xbongbong.paas.pojo.dto.FormDataUpdateDTO;
import com.xbongbong.paas.pojo.dto.SaasFormSaveDTO;
import com.xbongbong.paas.pojo.vo.AfterSaveVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.formdata.pojo.SaasNeedRedundantAttrPojo;
import com.xbongbong.saas.domain.entity.WorkOrderEntity;
import com.xbongbong.saas.domain.entity.ext.PurchaseEntityExt;
import com.xbongbong.saas.enums.RedundantTemplateTypeEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;


/**
 * 创建时间： 2019/1/10 16:44
 * 修改时间： 2019/1/10 16:44 梁鲁江
 *
 * @author 梁鲁江
 */
public interface  ProModelService {
    /**
     * 插入
     * @param formDataAddDTO 表单新建数据入参
     * @param paasFormDataEntity 表单数据
     * @param paasFormEntityExt 表单
     * @throws XbbException 业务异常
     */
    AfterSaveVO insert(FormDataAddDTO formDataAddDTO, PaasFormDataEntity paasFormDataEntity, PaasFormEntityExt paasFormEntityExt) throws XbbException;

    /**
     * 更新
     * @param formDataUpdateDTO 表单新建数据入参
     * @param paasFormDataEntity 表单数据
     * @param oldPaasFormDataEntity 老数据
     * @throws XbbException 业务异常
     */
    AfterSaveVO update(FormDataUpdateDTO formDataUpdateDTO, PaasFormDataEntity paasFormDataEntity, PaasFormDataEntity oldPaasFormDataEntity, PaasFormEntityExt paasFormEntityExt) throws XbbException;
    /**
     * 获取老实体
     *
     * @param formDataUpdateDTO 更新入参
     * @author feng.zheng
     * @return com.xbongbong.paas.domain.entity.PaasFormDataEntity
     * @throws XbbException 业务异常
     * @date 2019/1/29 16:38
     */
    PaasFormDataEntity getOldPaasFormDataEntity(FormDataUpdateDTO formDataUpdateDTO) throws XbbException;
    /**
     * Description: 工单插入
     * @param formDataAddDTO 表单新建数据入参
     * @param workOrderEntity 表单数据
     * @return java.lang.Long
     * @throws XbbException XbbException
     * @author 魏荣杰/pro/v1/form/data/add
     * @date 2019/4/12 11:14
     * @since v1.0
     */
    Long insertWorkOrder(FormDataAddDTO formDataAddDTO, WorkOrderEntity workOrderEntity) throws XbbException;

    /**
     * Description: 获取工单老实体
     * @param formDataUpdateDTO 更新入参
     * @return com.xbongbong.saas.domain.entity.WorkOrderEntity
     * @throws XbbException
     * @author 魏荣杰
     * @date 2019/4/18 13:42
     * @since v1.0
     */
    WorkOrderEntity getOldWorkOrderEntity(FormDataUpdateDTO formDataUpdateDTO) throws XbbException;


    /**
     * 编辑进审批，流程状态修改后修改原数据状态
     * @param paasProcessDataEntity
     */
    void updateFormDataStatus(PaasProcessDataEntity paasProcessDataEntity, Integer flowStatus) throws XbbException;

    /**
     * 获取实体
     * @param corpid
     * @param businessType
     * @param saasMark
     * @param dataId
     * @author 吴峰
     * @return com.xbongbong.paas.domain.entity.PaasFormDataEntity
     * @throws XbbException 业务异常
     * @date 2019/1/29 16:38
     */
    PaasFormDataEntity getFormDataEntity(String corpid, Integer saasMark, Integer businessType, Long dataId) throws XbbException;

    /**
     * 合同保存回款计划
     * @param saasFormSaveDTO
     * @param paasFormDataEntity
     * @param saasNeedRedundantAttrPoJo
     * @return void
     * @author 吴峰
     * @date 2021/2/5 15:38
     * @throws XbbException
     */
    void saveLinkPayment(SaasFormSaveDTO saasFormSaveDTO, PaasFormDataEntity paasFormDataEntity, SaasNeedRedundantAttrPojo saasNeedRedundantAttrPoJo) throws XbbException;

    /**
     * 合同保存回款单
     * @param saasFormSaveDTO
     * @param paasFormDataEntity
     * @param saasNeedRedundantAttrPoJo
     * @return void
     * @author 吴峰
     * @date 2021/2/5 15:38
     * @throws XbbException
     */
    void saveLinkPaymentSheet(SaasFormSaveDTO saasFormSaveDTO, PaasFormDataEntity paasFormDataEntity, SaasNeedRedundantAttrPojo saasNeedRedundantAttrPoJo) throws XbbException;

    void saveLinkPayPlan(SaasFormSaveDTO saasFormSaveDTO, PaasFormDataEntity paasFormDataEntity, SaasNeedRedundantAttrPojo saasNeedRedundantAttrPoJo, PurchaseEntityExt purchaseEntityExt) throws XbbException;

    void saveLinkPayPlanSheet(SaasFormSaveDTO saasFormSaveDTO, PaasFormDataEntity paasFormDataEntity, SaasNeedRedundantAttrPojo saasNeedRedundantAttrPoJo, PurchaseEntityExt purchaseEntityExt) throws XbbException;


    void setDefaultData(RedundantTemplateTypeEnum redundantTemplateTypeEnum, JSONObject dataList);
}
